#include<iostream>
#include<vector>
#include<set>
using namespace std;

class Solution {
public:
    int findContentChildren(vector<int>& g, vector<int>& s) {
        multiset<int> appetite(g.begin(), g.end());
        multiset<int> size(s.begin(), s.end());

        auto ait = appetite.begin();
        auto sit = size.begin();
        int cnt = 0;
        while(ait != appetite.end() && sit != size.end()){
           if(*sit >= *ait){
            ++cnt;
            ++ait;
           }
          ++sit;
        }
        return cnt;
    }
};
